<template>
  <div class="box">
    
    <div class="mainBox"> 
      <div class="leftBox">
        <div class="leftBox_title">
          监管验收片块信息
        </div>
        <div class="leftBox_title_sub">
          <div class="leftBox_title_sub_piankuai leftBox_title_sub_text"><span>片块名：</span>{{rowInfo.villageName+rowInfo.landName}}</div>
        </div>
        <div class="leftBox_title_sub">
          <div class="leftBox_title_sub_piankuai leftBox_title_sub_text"><span>监理验收时间：</span>{{rowInfo.time}}</div>
          <div class="leftBox_title_sub_shijian leftBox_title_sub_text"><span>验收人员：</span>{{rowInfo.name}}</div>
        </div>
        <div class="project_result">
          <div class="display_flex display_flex_haveAlign radioStyle">
            <p>监管验收是否通过：</p>
            <el-radio-group v-model="rowInfo.yesOrNo" disabled>
              <el-radio label="YES">是</el-radio>
              <el-radio label="NO">否</el-radio>
            </el-radio-group>
          </div>
          <div class="display_flex">
            <p>监管验收结论：</p>
            <p class="jielun">{{ziyanText}}</p>
            <!-- <el-input
              :readonly="true"  
              type="textarea"
              :rows="5"
              resize="none"
              v-model="ziyanText"
            ></el-input> -->
          </div>
        </div>
        <div class="leftBox_line"></div>
        <div class="fujianBox">
          
          <div class="fujianList" v-if="imgArr.length!=0">
            <div class="fujianList_item" v-for="(item,index) in imgArr" :key="index">
              <div class="fujianList_item_left">{{item.fileName}}</div>
              <div class="fujianList_item_right" @click="toSee(item)">查看</div>
            </div>
          </div>
          <div class="fujianList fujianNoData" v-else>
            暂无数据
          </div>
        </div>
      </div>
      <div class="rightBox">
        <tdMap class="mapBox_right" ref="tdMap" :pkList="mainDataData" :isShowControls="false" />
      </div>
    </div>
    <!-- <div class="landInfo">
      
      <div class="title">
        <p class="title_one">{{rowInfo.villageName+rowInfo.landName}}</p>
        <p class="title_little">
          <span>监管验收时间：{{rowInfo.time}}</span>
          <span>验收人员：{{rowInfo.name}}</span>
        </p>
      </div>
      <div class="project_position">
        <div class="project_title">监管验收结果和结论</div>
        <div class="project_result">
          <div class="display_flex radioStyle">
            <p>监管验收是否通过：</p>
            <el-radio-group v-model="rowInfo.yesOrNo" disabled>
              <el-radio label="YES">是</el-radio>
              <el-radio label="NO">否</el-radio>
            </el-radio-group>
          </div>
          <div class="display_flex">
            <p>监管验收结论</p>
            <el-input
              :readonly="true"
              type="textarea"
              :rows="5"
              resize="none"
              v-model="ziyanText"
            ></el-input>
          </div>
        </div>
      </div>
      <div class="project_position">
        <div class="project_title">监管验收现场位置及轨迹</div>
        <div class="project_img">
          <tdMap style="height: 600px" class="mapBox_right" ref="tdMap" :pkList="mainDataData" :isShowControls="false" />
        </div>
      </div>
      <div class="project_position">
        <div class="project_title">监管验收资料</div>
        <div class="project_img">
          <el-table :data="imgArr" border style="width: 100%">
            <el-table-column type="index" show-overflow-tooltip label="序号" width="60"></el-table-column>
            <el-table-column prop="fileName" label="类型" width="200"></el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="primary"
                  fixed="left"
                  @click="toSee(scope.row)"
                >查看</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
    </div> -->

    <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="seeImgDialog" width="50%">
      <div class="seeImg">
        <img :src="$https+imgPath" width="80%" height="500">
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  constructingSelfSupervisingInfo,
  constructingSelfSupervisingCheck
} from "@/api/jianguanYanshou";
import {selectErlyMultiPolygon} from '@/api/common'
import tdMap from "@/components/tdMap";
export default {
  components: {
    tdMap
  },
  data() {
    return {
      //综合监管信息附件类型切换
      fujianType:1,
      radio: "",
      tableData: [],
      needInfo: {
        page: 1,
        size: 10
      },
      imgPath:'',
      seeImgDialog: false,
      imgArr: [],
      title: "",
      textarea: "",
      itemData: "", //单条数据
      ziyanText: "", //自验结论

      rowInfo:{
        landId:'',
        landName:'',
        name:'',
        time:'',
        villageName:'',
        yesOrNo:''
      },
      mainDataData:[]
    };
  },
  
  mounted() {
    console.log(this.$route.query,'123')
    this.rowInfo={
      landId:this.$route.query.id,
      landName:this.$route.query.landName,
      name:this.$route.query.name,
      time:this.$route.query.time,
      villageName:this.$route.query.villageName,
      yesOrNo:this.$route.query.yesOrNo
    }
    this.ziyanText=this.$route.query.opinion
    this.getData();
    this.getImg()
  },
  methods: {
    //切换附件类型事件
    changeFujianType(type){
      this.fujianType=type
    },
    toSee(info){
      console.log(info)
      this.seeImgDialog=true
      this.imgPath=info.filePath
      this.title=info.fileName
    },
    getImg(){//获取施工自验图片
      let obj={
        landId:this.rowInfo.landId,
        page:1,
        size:99
      }
      constructingSelfSupervisingCheck(obj).then(res=>{
        if(res.code==1000){
          let array=[]
          res.data.rows.forEach((item,index)=>{
            var strIndex=item.indexOf('.')
            var str=item.substring(strIndex,item.lengnth)
            array.push({
              fileName:'监管验收照片'+(index+1)+str,
              filePath:item
            })
          })
          console.log(array,'arr')
          this.imgArr=array
          
        }
      })
    },
    getData() {
      let obj={
        landId:this.rowInfo.landId
      }
      selectErlyMultiPolygon(obj).then(res=>{
        let obj = res.data;
        let array = [];
        array.push(obj);
        this.mainDataData=array
      })
    },
    btnSeeImg(title) {
      this.title = title;
      this.seeImgDialog = true;
    },
    
  }
};
</script>

<style lang="scss" scoped>
* {
  box-sizing: border-box;
}
.box {
  padding: 30px 40px;
  box-sizing: border-box;
  
}
.display_flex {
  display: flex;
}
.display_flex.display_flex_haveAlign{
  align-items: center;
}
.display_flex div {
  margin-right: 20px;
  font-size: 14px;
  color: #333;
}
.project_result .display_flex {
  margin: 20px 0;
}
.project_result .display_flex p {
  font-size: 13px;
  color: #444;
  width: 160px;
}
.project_result .display_flex:first-child p {
  width: 160px;
}
.project_result .display_flex .jielun{
  width: 50%;
  word-wrap:break-word;
}
.zonghe_table {
  margin: 20px 0px;
}
.pages {
  text-align: center;
}
.seeImg {
  text-align: center;
}
.landInfo {
  border: 1px solid #efefef;
  box-sizing: border-box;
}
.back {
  margin: 20px;
}
.title_one {
  text-align: center;
  line-height: 40px;
  font-size: 20px;
  color: #444;
  font-weight: bold;
}
.title_little {
  font-size: 13px;
  color: #999;
  margin: 40px 20px 20px 30px;
}
.title .title_little span {
  margin-right: 30px;
}
.project_title {
  background: #f8f8f8;
  height: 50px;
  background: #f8f8f8;
  padding: 0px 30px;
  line-height: 50px;
  color: #48494d;
  font-size: 14px;
  font-weight: bold;
  border-top: 1px solid #efefef;
  border-bottom: 1px solid #efefef;
}
.project_img {
  padding: 30px;
}
.radioStyle /deep/ .is-checked .el-radio__label{
  color: #409EFF
}
.radioStyle /deep/ .is-checked .el-radio__inner::after{
  /* color: #409EFF; */
  width: 4px;
  height: 4px;
  border-radius: 100%;
  background-color: #409EFF;
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
}

.mainBox{
  width: 100%;
  display: flex;
  height: calc(100vh - 174px);
}
.leftBox{
  width: 30%;
  margin-right: 5%;
}
.leftBox_title{
  color: #4D4D4D;
  font-size:18px;
  font-weight:bold;
  line-height:25px;
}
.leftBox_title_sub{
  display: flex;
  align-items: center;
  margin-top: 20px;
  margin-bottom: 20px;
}
.leftBox_title_sub .leftBox_title_sub_piankuai{
  margin-right: 40px;
}
.leftBox_title_sub .leftBox_title_sub_text{
  color: #595959;
  font-size: 14px;
}
.leftBox_title_sub_text span{
  color: #737373;
}
.leftBox_line{
  height:1px;
  background:rgba(235,238,245,1);
  opacity:1;
  margin-top: 30px;
  margin-bottom: 14px;
}
.fujianBox_tabs{
  display: flex;
  align-items: center;
}
.fujianBox_tabs_item{
  width:60px;
  height:28px;
  background:#F0F3F5;
  opacity:1;
  border-radius:2px;
  color: #696969;
  font-size: 14px;
  margin-right: 8px;
  text-align: center;
  line-height: 28px;
  cursor: pointer;
}
.fujianBox_tabs_item.on{
  background:#409EFF;
  color: #fff;
}
.fujianList{
  margin-top: 14px;
}
.fujianList_item{
  width: 100%;
  display: flex;
  justify-content: space-between;
  height: 56px;
  line-height: 56px;
}
.fujianList_item .fujianList_item_left{
  color: #606266;
  font-size: 14px;
}
.fujianList_item .fujianList_item_right{
  color: #409EFF;
  font-size: 14px;
  cursor: pointer;
}
.rightBox{
  width: 70%;
}
.fujianNoData{
  text-align: center;
  margin-top: 50px;
  letter-spacing: 8px;
  color: #696969;
}
</style>